//    Copyright (C) 2010 by Dolph Technology
//    All rights reserved.
// 
//    Copyright Notification
//    No part may be reproduced except as authorized by written permission
// 
//    @file   dti_mux.v
//    @par    Company:
//              Dolphin Technology
//    @par    Project:
//              [projectname]
//    @par    Author:
//              N. Huy Bui
//    @par    Date:
//              [date created]
//    @brieft
//              [a brieft description of the module]
//$Id$

module dti_mux (data_in, sel, data_out);

parameter 	  IN_WIDTH    = 24;
parameter 	  OUT_WIDTH   = 8;
localparam 	  K 	      = IN_WIDTH/OUT_WIDTH;
localparam 	  SEL_WIDTH   = $clog2(K);

input 	  [IN_WIDTH-1:0] data_in;
input 	  [SEL_WIDTH-1:0] sel;
output    [OUT_WIDTH-1:0] data_out;

genvar i;
generate 
//  always @ (sel, data_in)
  for (i=0;i<OUT_WIDTH;i=i+1)
  assign  data_out [i] = data_in [i+sel*OUT_WIDTH];
endgenerate

// always @ (data_in, sel)
// begin
//   case (sel)
//     0: data_out = data_in [7:0];
//     1: data_out = data_in [15:8];
//     2: data_out = data_in [23:16];
//     default: data_out = 8'bz;
//   endcase
// end

endmodule // dti_mux
